package com.opoc.mapper;

import com.opoc.pojo.Report;
import com.opoc.pojo.Report_sql;
import com.opoc.pojo.Result;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;

import java.util.Date;
import java.util.List;

/**
 * @program: opoc
 * @description: 检测报告
 * @author: lyx
 * @create: 2023-10-26 14:45
 */
@Mapper
public interface ReportMapper {
    /*
    * 获取检测报告基本信息
    * */
    List<Report> getReportInfo(@Param("company_id")String company_id,
                               @Param("company_name")String company_name,
                               @Param("contacts")String contacts);

    /**
     * 添加检测报告
     * */
    void addReport(@Param("company_id")String company_id,
                   @Param("date")String date,
                   @Param("people")String people,
                   @Param("report_file")String report_file);


    /*
    * 删除检测报告
    * */
    void deleteReport(@Param("company_id")String company_id);

/*
* 判断公司是否存在
* */
@Select("select exists(select * from company where company_id = #{company_id})")
Boolean validReportById(String company_id);
/*
* 上传文件
* */

void uploadFile(@Param(value="company_id") String company_id,
                @Param(value = "report_file_path") String report_file_path);
/*
* 根据company_id获取company_name
* */

@Select("select company_name from company where company_id=#{company_id}")
    String findById(@Param("company_id")String company_id);

/**
 * 根据company_id获取检测报告的url
 * */
    @Select("select report_file_path from report where company_id=#{company_id}")
    String URLfindId(@Param("company_id")String company_id);

}
